﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NLBS.Data;
using NLBS.Entity;
using NLBS.Framework;
using System.Text;
using NLBS.Web.UI;
using NLBS.Views;
using System.Collections.Generic;
using System.Reflection;
using NLBS.Text;
using NLBS.Web;


namespace NLBS.Control
{
    public partial class guestbook : BaseUserControl, IGuestBookView
    {
        #region Presenter

        private GuestBookPresenter _presenter;

        public GuestBookPresenter Presenter
        {
            get
            {
                
                if (this._presenter == null)
                    _presenter = new GuestBookPresenter();
                this._presenter.View = this;
                return _presenter;
            }
        }
        
        #endregion 

        protected void BindGBook()
        {
            startIndex = AspNetPager1.StartRecordIndex;
            this.pageSize = AspNetPager1.PageSize;       
            DataHelp.GetGuestBook(AspNetPager1, guestBookList, GBookList);
        }

        #region IGuestBookView Members

        private List<GuestBook> _gbookList;
        public List<GuestBook> GBookList
        {
            set { _gbookList=value; }
            get { return _gbookList; }
        }

        private bool _enableGBook;
        public bool EnableGBook
        {
            set { _enableGBook=value; }
            get { return _enableGBook; }
        }

        private string _pageUrl;
        public string pageUrl
        {
            get
            {
                return _pageUrl;
            }
            set
            {
                _pageUrl = value;

                AspNetPager1.EnableUrlRewriting = true;
                AspNetPager1.UrlRewritePattern = _pageUrl;

            }
        }

        public string q
        {
            get { return RequestWrapper.GetQueryString("q"); }
        }

        private int _startIndex;
        public int startIndex
        {
            get
            {
                return _startIndex;
            }
            set
            {
                _startIndex = value;
            }
        }
        private int _pageSize;
        public int pageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {

                _pageSize = value;
            }
        }

        #endregion
    }
}